02. Loading Streetview
Loading Streetview
Question:
Start Quiz:
Solution:
INSTRUCTOR NOTE:
Google Streetview image requests must include the size
and location
parameters.
In the video, Cameron adds the concatenated streetStr
and cityStr
values to the string: http://maps.googleapis.com/maps/api/streetview?size=600x300&location=
to create a complete image request that includes the required parameters.
Learn how to collect <input>
values with jQuery here.
Interested in diving into the Google Street View API? Check out its documentation
You can find the AJAX project in the Downloadables section: Udacity_AJAX_INIT
Clicking on Udacity_AJAX_INIT will download a .zip file. Uncompress it and you'll find a directory with HTML, CSS and JS files. You'll be editing js/script.js.
Open index.html with your browser to test the page.
You'll also need to use jQuery's append method to add an <img>
to the page. Make sure it has a class of bgimg
. For example: $body.append('<img class="bgimg" src="http://example.com/someimage.png">');
Notice how the new <img>
HTML element is just a string passed into .append()
.